home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 3.2 KB | 149 lines |
- package symantec.itools.awt.shape;
-
-
- import java.awt.Canvas;
- import java.awt.Dimension;
- import java.awt.Color;
- import symantec.itools.awt.BevelStyle;
-
-
- /**
- * Abstract class for shape components.
- * This is the parent Shape class for the various
- * shape components.
- * @see symantec.itools.awt.shape.Ellipse
- * @see symantec.itools.awt.shape.Rectangle
- * @version 1.0, Nov 26, 1996
- * @author Symantec
- */
-
- public abstract class Shape
- extends Canvas
- implements BevelStyle
- {
- /**
- * Width of this shape.
- */
- protected int width;
-
- /**
- * Height of this shape.
- */
- protected int height;
-
- /**
- * Border style of this shape.
- */
- protected int style;
-
- /**
- * Shape is filled if true.
- */
- protected boolean fill;
-
- /**
- * Color to fill shape with if fill is true.
- */
-
- protected Color fillColor;
-
- /**
- * Construct default Shape with BEVEL_LINE style.
- */
- protected Shape()
- {
- style = BEVEL_LINE;
- }
-
- /**
- * Sets the border style of the shape.
- * @see #getBevelStyle
- */
- public void setBevelStyle(int s)
- {
- style = s;
- repaint();
- }
-
- /**
- * Returns the current style of the shape.
- * @see #setBevelStyle
- */
- public int getBevelStyle()
- {
- return style;
- }
-
- /**
- * Sets the fill mode of the shape.
- * @see #getFillMode
- */
- public void setFillMode(boolean f)
- {
- fill = f;
- repaint();
- }
-
- /**
- * Returns the current fill mode of the shape.
- * @see #setFillMode
- */
- public boolean getFillMode()
- {
- return fill;
- }
-
- /**
- * Sets the fill color of the shape.
- * @see #getFillColor
- */
- public void setFillColor(Color color)
- {
- fillColor = color;
- repaint();
- }
-
- /**
- * Returns the current fill color of the shape.
- * @see #setFillColor
- */
- public Color getFillColor()
- {
- return fillColor;
- }
-
- /**
- * Moves and/or resizes this component.
- * This is a standard Java AWT method which gets called to move and/or
- * resize this component. Components that are in containers with layout
- * managers should not call this method, but rely on the layout manager
- * instead.
- *
- * @param x horizontal position in the parent's coordinate space
- * @param y vertical position in the parent's coordinate space
- * @param width the new width
- * @param height the new height
- */
- public void reshape(int x, int y, int width, int height)
- {
- this.width = width;
- this.height = height;
-
- super.reshape(x, y, width, height);
- }
-
- /**
- * Returns the recommended dimensions to properly display this component.
- * This is a standard Java AWT method which gets called to determine
- * the recommended size of this component.
- *
- * @return horiziontal and vertical dimensions of 50, 50
- *
- * @see java.awt.Component#minimumSize
- */
- public Dimension preferredSize()
- {
- return new Dimension(50, 50);
- }
- }
-